/*------------------------------------------------------------------------
* (The MIT License)
* 
* Copyright (c) 2008-2011 Rhomobile, Inc.
* 
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* 
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* 
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
* 
* http://rhomobile.com
*------------------------------------------------------------------------*/

package com.rhomobile.rhodes.extmanager;

import com.rhomobile.rhodes.RhodesActivity;
import com.rhomobile.rhodes.RhodesService;

import android.app.Dialog;
import android.content.Intent;
import android.content.res.Configuration;
import android.view.KeyEvent;
import android.os.Bundle;

public interface IRhoListener {

    void onCreate(RhodesActivity activity, Intent intent);
    void onStart(RhodesActivity activity);
    void onResume(RhodesActivity activity);
    void onPause(RhodesActivity activity);
    void onStop(RhodesActivity activity);
    void onDestroy(RhodesActivity activity);
    void onNewIntent(RhodesActivity activity, Intent intent);
    void onNewIntent(RhodesService service, Intent intent);
    void onActivityResult(RhodesActivity activity, int requestCode, int resultCode, Intent intent);
    Dialog onCreateDialog(RhodesActivity activity, int id/*, Bundle args*/);
    void onConfigurationChanged(RhodesActivity activity, Configuration newConfig);
    
    void onCreateApplication(IRhoExtManager extManager);
    /**
	 * Called when a key press is detected by the RhodesActivity. Be aware, this interface will
	 * provide more than just key down events. See the Android documentation for the KeyEvent
	 * class for more information
	 * @param keyCode the code of the key pressed/released etc.
	 * @param event the KeyEvent generated by the key press/release etc.
	 * @return True if the listener has consumed the event, false to let it bubble to other listeners/views. 
	 */
	boolean onKey(int keyCode, KeyEvent event);
	
	/**
	 * Called whenever the RhoElements Browser License Screen becomes visible 
	 * @author Ben Kennedy (NCVT73)
	 */
	void onEBLicenseVisible();
	
	/**
	 * Called whenever the RhoElements Browser License Screen hides. The license screen will
	 * reappear after 5 minutes and onEBLicenseVisible will be shown.
	 * @author Ben Kennedy (NCVT73)
	 */
	void onEBLicenseHidden();
	
	/**
	 * Called when the RhoElements Browser License Screen is destroyed. This will only occur if:
	 *  - The product is already licensed. In this case the splash screen will show, and then be destroyed
	 *  - The user licenses the product.
	 * When this method is called, onEBLicenseHidden will not be called.
	 * @author Ben Kennedy (NCVT73)
	 */
	void onEBLicenseDestroyed();

	void onSaveInstanceState(Bundle outState);
}
